home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_089 / autoenquirer / poster < prev    next >
Text File  |  1992-05-06  |  4KB  |  92 lines

  1. Article 6213 of comp.sys.amiga:
  2. Path: mcdsun!noao!hao!hull
  3. From: hull@hao.UCAR.EDU (Howard Hull)
  4. Newsgroups: comp.sys.amiga
  5. Subject: autoEnquire() - a friendly but nosey requester
  6. Keywords: positionable requester with memory & Gray's Terrain w/Manx dyn alloc
  7. Message-ID: <775@hao.UCAR.EDU>
  8. Date: 12 Jul 87 01:01:52 GMT
  9. Distribution: na
  10. Organization: High Altitude Obs./NCAR, Boulder CO
  11. Lines: 831
  12.  
  13.  
  14. This is a program that creates an example of a contraption that I wish to
  15. call an "AutoEnquirer" - it's like a requester except it's not quite as
  16. demanding and goes where you want to put it.  I'd love to see this included
  17. in 1.3 (CA: HINT, HINT).  When you call Intuition's AutoRequest function,
  18. you can specify the size, but not the location of the requester.  The
  19. autoEnquire function lets you specify the location, but not the size.
  20. The autoEnquire contraption is nosey, like its namesake, but it also knows
  21. that it can work better if it doesn't irritate you.  It therefore also has
  22. the property that if the user moves it (in order to see what's under it -
  23. in case that's important to the question at hand) the next time it's
  24. called, it shows up where the user left it last.  To fabricate this beastie,
  25. I snarfed a lot of code; I used giant hunks of John Draper's Menu and
  26. Requester tutorial (from the WELL) and also used Chris Gray's Fractalish
  27. Terrain Generator as a test bed.  Since the Terrain generator would not
  28. compile under Manx, I have it here for you in a 16-bit integer Manxification
  29. by means of Dynamic Allocation.  Also, I want to thank Steve Drew for the
  30. Manx version of the Matt Dillon Shell, which has saved me a lot of disk
  31. swaps, and Dave Wecker for the shar program used to package the stuff below.
  32.  
  33. To compile, unshar the mess below into an empty directory to get the header,
  34. atv.h, the terrain code atv.c and the autoEnquirer code enq.c and then do
  35. these commands to compile and link (Manx Aztec C 3.04a 512K Amiga 1000):
  36.  
  37.         cc atv.c
  38.         cc enq.c
  39.         ln atv.c enq.c -lc
  40.  
  41. Now then, you sharks out there, realize that I am a VERY novice C programmer,
  42. so this code is going evoke comments like "What th... why the HELL did he do
  43. THAT!"  I had to de-subroutinize a couple of things because I could not find
  44. out how to define an array of pointers to dynamically allocated data which
  45. could be transferred to a subroutine without evoking an error from Manx.
  46. something like
  47.         #define XLIMIT 256L
  48.         #define YLIMIT 128L
  49.         ...
  50.         short *Cell[256];
  51.         void boogie();
  52.         unsigned short n, m, i, j, x, y;
  53.         ...
  54.         void boogie(Cell, p)
  55.         short *Cell[];
  56.         int p;
  57.         {
  58.         unsigned short l,c;
  59.         for (l=0; l<YLIMIT; l++)
  60.             {
  61.             for (c=0; c<XLIMIT)
  62.             {
  63.                 Cell[n][m] = (short)(p*Cell[l][c]);
  64.             }
  65.         }
  66.         }
  67.         ...
  68.         main()
  69.         {
  70.         ...
  71.         Cell[n][m] = boogie(&Cell[0][0], (Cell[x][y] + Cell[i][j]))
  72.         ...
  73.         }
  74. gets tagged with an error concerning the subroutine definition of Cell.
  75. So I want those comments!  (Use EMAIL please.)  That's also why I'm posting
  76. this to just this newsgroup; there's no .uue file because this is a compiler
  77. curiosity only (Gray's Terrain Generator has already been posted as compiled
  78. under Draco, ok?)  In looking this over, I just noticed one thing I should
  79. have fixed - I used :ts=4 for tab stops in the Manx z editor.  Since vi uses
  80. 8 spaces for tabs, there'll be trouble there and with many other editors.
  81. For vi you can say ":set tabstop=4" and it should be a little more readable.
  82. I'll be out of town all next week (they usually try to send me out of town
  83. just before I put out a net article, it seems.  I wonder why...) so don't
  84. expect an immediate response.
  85.  
  86.                                 Howard Hull
  87. [If yet unproven concepts are outlawed in the range of discussion...
  88.                  ...Then only the deranged will discuss yet unproven concepts]
  89.     {ucbvax!hplabs | decvax!noao | mcvax!seismo | ihnp4!seismo} !hao!hull
  90.     for domain mailers: hull@hao.ucar.edu
  91.  
  92.